package study.linux.laptrinhlinux.mysql.source;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class LooseIndexScan {
	public static void main(String[] args) throws Exception{
		Connection conn = null;
		Statement stmt = null;
		ResultSet rs = null;
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		String connectionUrl = "jdbc:mysql://localhost:3306/test";
		String connectionUser = "testhost";
		String connectionPassword = "testhost";
		conn = DriverManager.getConnection(connectionUrl, connectionUser, connectionPassword);
		stmt = conn.createStatement();
		rs = stmt.executeQuery("SELECT * FROM user");
		while (rs.next()) {
			String id = rs.getString("id");
			String firstName = rs.getString("name");
			System.out.println("ID: " + id + ", Name: " + firstName);
		}
	}
}
